import {Modal,message} from 'antd';
import { WeaLocaleProvider } from 'ecCom';
const getLabel = WeaLocaleProvider.getLabel;

//警告
const fnaWarning = (info) => {
    info = (<div dangerouslySetInnerHTML={{__html: info}}/>);
    Modal.warning({
        title: getLabel(15172,'系统提示'),
        okText: getLabel(826,'确定'),
        style:{ top: 40,left:200 },
        content: info,
        maskClosable:false,
        onOk:() => {}
    });
}

//简单对话框
const fnaSimpleConfirm = (info) => {
    info = (<div dangerouslySetInnerHTML={{__html: info}}/>);
    Modal.confirm({
        title: getLabel(131329,'信息确认'),
        content: info,
        okText: getLabel(826,'确定'),
        cancelText: getLabel(31129,'取消'),
        onOk() {},
        onCancel() {}
    });
}

//带回调函数的对话框
const fnaConfirm = (info,func) => {
    info = (<div dangerouslySetInnerHTML={{__html: info}}/>);
    Modal.confirm({
        title: getLabel(131329,'信息确认'),
        content: info,
        okText: getLabel(826,'确定'),
        cancelText: getLabel(31129,'取消'),
        onOk() {
          func();
        },
        onCancel() {}
    });
}

//成功的提示
const fnaSuccess = (info) => {
    info = (<div dangerouslySetInnerHTML={{__html: info}}/>);
    Modal.success({
        title: getLabel(15172,'系统提示'),
        content: info,
        okText: getLabel(826,'确定'),
        onOk() {},
      });
}

//成功的提示
const fnaSuccessTip = (info) => {
    message.success(info);
}

//失败的提示
const fnaErrorTip = (info) => {
    message.error(info);
}

//警告的提示
const fnaWarningTip = (info) => {
    message.warning(info);
}

export {
    fnaWarning,
    fnaSimpleConfirm,
    fnaConfirm,
    fnaSuccess,
    fnaSuccessTip,
    fnaErrorTip,
    fnaWarningTip
}